<?php
  // no direct access
  defined( '_JEXEC' ) or die( 'Restricted access' );
  jimport('joomla.application.component.controller');
  
  class VenuesController extends JController
  {  
    function display(){
      
      $document =& JFactory::getDocument();
      $view = & $this->getView($this->_name, $document->getType());
      
      $venue   = $this->getModel('venue', 'venuemodel');
      $venues  = $venue->get();
      if($venues)
        $this->prepare_venues($venues);
      
      $view->assign("venues", $venues);
      $view->display();
    }
    
    private function prepare_venues(&$venues){
      
      $pic   = $this->getModel('pic', 'picmodel');
      
      foreach($venues as $venue)
        $venue->pic = $pic->get($venue->pic_id);
      
    }
    
  }
?>